<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>知识图谱</title>
    <link rel="stylesheet" href="{{ url_for('static',filename='bootstrap/bootstrap@4.6.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/init.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/test.css') }}">
    <script src="{{ url_for('static',filename='dist_neovis.js') }}"></script>
    <script src="{{ url_for('static',filename='jquery/jquery-2.1.1.min.js')}}"></script>
    <script>
var viz;
function draw() {
    var config = {
        container_id: "viz",
        server_url: "bolt://localhost:7687",
        server_user: "neo4j",
        server_password: "jin13707297024",
        arrows:true,
        labels: {
            //"Character": "name",
            "人": {
                "caption": "高管姓名", //节点显示的内容
                "title_properties": [ //鼠标移到节点上显示的内容
                    "年龄",
                    "性别",
                    "职位",
                    "股票代码"
                ]
            },
            "概念": {
                "caption": "概念名称",
                "title_properties": [
                    "ConceptId"
                ]
            },
             "股票":{
                        "caption":"股票名称",
                        "title_properties":[
                            "股票代码"
                        ]
                    },
            "行业":{
                        "caption":"行业名称",
                        "title_properties":[
                            "Industry"
                        ]
                    },
        },
        relationships: {
            "belong_to":{
                "thickness":"关系的宽度",
                "caption":false,
            },
            "work_in":{
                 "thickness":"关系的宽度",
                "caption":true,

            }
        },
        initial_cypher: "MATCH (n:`股票`) RETURN n LIMIT 25"


    };

    viz = new NeoVis.default(config)
    viz.render();
    console.log(viz);
}
</script>
</head>
<body onload="draw()">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
          <a class="navbar-brand" href="#">e投资</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="/">首页 <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="{{ url_for('qa.public_question') }}">发布问答</a>
      </li>
      <li class="nav-item">
        <a class="nav-link " href="{{ url_for('neo4j.get_graph') }}" >知识图谱</a>
      </li>
        <li class="nav-item">
        <a class="nav-link" href="{{ url_for('data.get_database') }}">数据库</a>
      </li>
           <li class="nav-item">
        <a class="nav-link" href="{{ url_for('publish.get_news_publish') }}">上传数据</a>
      </li>
       <!-- <li class="nav-item ml-2">
            <form class="form-inline my-2 my-lg-0" method="GET" action="{{ url_for('qa.search') }}">
      <input class="form-control mr-sm-2" type="search" placeholder="关键字" aria-label="Search" name="q">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
    </form>
        </li>-->
    </ul>


      <ul class="navbar-nav ">
      {% if user %}

          <li class="nav-item ">
              <span class="nav-link">{{ user.username }}</span>
          </li>
      <li class="nav-item">
        <a class="nav-link" href="{{ url_for("user.logout") }}">退出登录</a>
      </li>


      {% else %}


          <li class="nav-item ">
        <a class="nav-link" href="{{ url_for('user.login') }}">登录</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="{{ url_for('user.register') }}">注册</a>
      </li>
    {% endif %}

    </ul>

  </div>
    </div>
</nav>
<div class="container"></div>





<div id="viz"></div>

<div class="query">
    <p id="cypher1">Cypher Query:</p>
<textarea  rows="4" cols="40" id="cypher"></textarea><br>
    <div class="to_center1">
<input  type="submit" value="Submit" id="reload"> </div>
    <div class="to_center2">
<input  type="submit" value="Stabilize" id="stabilize"></div>

</div>


</body>
<script>
 $("#reload").click(function() {

		var cypher = $("#cypher").val();

        if (cypher.length > 3) {
			viz.renderWithCypher(cypher);
		} else {
			console.log("reload");
			viz.reload();

		}

	});

	$("#stabilize").click(function() {
		viz.stabilize();
	})

</script>
</html>